
<div id="toolbar-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>
  <div class="m">
    <div id="toolbar" class="toolbar">
        <table class="toolbar"><tbody><tr>
        	<td id="toolbar-save" class="button"><a class="toolbar" onClick="javascript: submitbutton('save'); return false;" href="javascript:void(0);"> <span title="Save" class="icon-32-save"> </span> Save </a> </td>
	        <td id="toolbar-cancel" class="button"><a class="toolbar" onClick="javascript: submitbutton('cancel'); return false;" href="javascript:void(0);"> <span title="Cancel" class="icon-32-cancel"> </span> Cancel </a> </td>
        </tr></tbody></table>
    </div>
    <div class="header icon-48-user">chỉnh sửa nội dung game</div>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
<div class="clr"></div>
<div id="submenu-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>
  <div class="m">
    <ul id="submenu">
      <li> <a href="<?php echo $this->Html->url(array('controller'=>'game_categories', 'action' => 'index')); ?>">Danh mục</a> </li>
      <li> <a href="<?php echo $this->Html->url(array('controller'=>'game_groups', 'action' => 'index')); ?>">Nhóm</a> </li>
      <li> <a class="active" href="<?php echo $this->Html->url(array('controller'=>'games', 'action' => 'index')); ?>">Games</a> </li>
    </ul>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
<div id="element-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>
  <div class="m">
<script language="javascript" type="text/javascript">
        $(document).ready(function(){
            var params  =   {
                wmode: 'transparent'
            };
            swfobject.embedSWF($('#flashGame_url').val(), "show_flash_game", "<?php echo $this->data['Game']['game_width']; ?>", "<?php echo $this->data['Game']['game_height']; ?>", "<?php echo $this->data['Game']['flash_version']; ?>","/img/expressInstall.swf", false, params, false);
             check_content_type();
            $('#GameContentType').change(function(){
                check_content_type();
            });
        });
        function check_content_type(){
                if( $('#GameContentType').val() == 'html'){
                    $('#content_upload').fadeOut(400, function(){
                        $('#content_htmlcode').fadeIn(700);
                    });
                }else{
                    $('#content_htmlcode').fadeOut(400, function(){
                        $('#content_upload').fadeIn(700);
                    });
                }
        }
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}
                if($('#GameTitle').val() == ''){
                    h3l_show_alert($('#GameTitle'), 'Vui lòng nhập title');
                    $('#GameTitle').focus();
                    return;
                }
                if($('#GameCatId').val() == ''){
                    h3l_show_alert($('#GameCatId'), 'Vui lòng chọn 1 danh mục');
                    $('#GameCatId').focus();
                    return;
                }

                submitform( pressbutton );
	}
</script>
    <?php echo $this->Form->create('Game', array('type'=>'file', 'style'=> 'clear: both;', 'name'=>'adminForm', 'id'=>'adminForm')); ?>
      <div class="col">
        <fieldset class="adminform">
        <legend>thông tin game</legend>
        <table cellspacing="1" class="admintable">
          <tbody>
            <tr>
              <td width="200" class="key"><label for="title">tên game </label>
              </td>
              <td>
                    <?php echo $this->Form->input('title', array('class'=>'inputbox', 'size'=> 40, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="play_times">Số lần chơi</label>
              </td>
              <td>
                    <?php echo $this->Form->input('play_times', array('class'=>'inputbox', 'size'=> 15, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="game_width">width</label>
              </td>
              <td>
                    <?php echo $this->Form->input('game_width', array('class'=>'inputbox', 'size'=> 15, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="game_height">height </label>
              </td>
              <td>
                    <?php echo $this->Form->input('game_height', array('class'=>'inputbox', 'size'=> 15, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="flash_version">flash version </label>
              </td>
              <td>
                    <?php echo $this->Form->input('flash_version', array('class'=>'inputbox', 'size'=> 15, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>

            <tr>
              <td width="200" class="key"><label for="like_times">Số người thích</label>
              </td>
              <td>
                    <?php echo $this->Form->input('like_times', array('class'=>'inputbox', 'size'=> 15, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="published"> Published </label>
              </td>
              <td>
                    <?php echo $this->Form->radio('published', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '1')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_icon">Hot icon </label>
              </td>
              <td>
                    <?php echo $this->Form->radio('hot_icon', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="show_fullscreen">Show full screen </label>
              </td>
              <td>
                    <?php echo $this->Form->radio('show_fullscreen', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '1')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="popular">Game phổ biến nhất</label>
              </td>
              <td>
                    <?php echo $this->Form->radio('popular', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game">Game hay nhất</label>
              </td>
              <td>
                    <?php echo $this->Form->radio('hot_game', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game_ordering">thứ tự xuất hiện của  game hay nhất</label>
              </td>
              <td>
                    <?php echo $this->Form->input('hot_game_ordering', array('class'=>'inputbox', 'size'=> 5, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game_daily">Game hay nhất trong ngày</label>
              </td>
              <td>
                    <?php echo $this->Form->radio('hot_game_daily', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game_daily_ordering">thứ tự xuất hiện của  game hay nhất trong ngày</label>
              </td>
              <td>
                    <?php echo $this->Form->input('hot_game_daily_ordering', array('class'=>'inputbox', 'size'=> 5, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game_incat">Game hay nhất trong danh mục</label>
              </td>
              <td>
                    <?php echo $this->Form->radio('hot_game_incat', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="hot_game_incat_ordering">thứ tự xuất hiện của  game hay nhất trong danh mục</label>
              </td>
              <td>
                    <?php echo $this->Form->input('hot_game_incat_ordering', array('class'=>'inputbox', 'size'=> 5, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="popular_incat">Game nhiều người chơi nhất trong danh mục</label>
              </td>
              <td>
                    <?php echo $this->Form->radio('popular_incat', array('1'=> 'Yes', 0=>'No'), array('legend'=>false,'default'=> '0')); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="popular_incat_ordering">thứ tự xuất hiện của  game nhiều người chơi nhất trong danh mục</label>
              </td>
              <td>
                    <?php echo $this->Form->input('popular_incat_ordering', array('class'=>'inputbox', 'size'=> 5, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="cat_id">thể loại</label>
              </td>
              <td>
                    <?php echo $this->Form->select('cat_id', $cat_data, array('empty'=> false,'secure'=>true)); ?>
              </td>
            </tr>
            <tr>
              <td width="200" class="key"><label for="group_id">Nhóm</label>
              </td>
              <td>
                    <?php echo $this->Form->select('group_id', $group_data, array('empty'=> false,'secure'=>true)); ?>
              </td>
            </tr>
           <tr>
              <td width="200" class="key"><label for="tags">Tags (phân cách nhau bằng dấu phảy (,) ): </label>
              </td>
              <td>
                    <?php echo $this->Form->input('tags', array('class'=>'inputbox', 'cols'=> 60, 'label'=> false, 'type'=>'textarea')); ?>
              </td>

            </tr>
            <tr>
              <td width="200" class="key"><label for="content_type">Kiểu dữ liệu nguồn</label>
              </td>
              <td>
                    <?php echo $this->Form->select('content_type',$contenttype_list, array('empty'=> false,'secure'=>true)); ?>
              </td>
            </tr>
            <tr>
                <td width="200" class="key"><label for="preview">Xem trước</label>
                <td>
                                        <p>
                    <?php
                        switch($content_type){
                            case 'swf':
                    ?>

                        <input type="hidden" name="flashGame_url" id="flashGame_url" value="<?php echo $flash_url; ?>" />
                        <div id="show_flash_game"></div>

                    <?php
                        break;
                        case 'dcr':
                    ?>
                    <object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://active.macromedia.com/director/cabs/sw.cab#version=6,0,1,0" width="600px" height="600px">
                        <param name="SRC" value="<?php echo $flash_url; ?>">
                        <param name="swRemote" value="swTarget='false'">
                        <embed src="<?php echo $flash_url; ?>" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-director" width="600px" height="600px" swRemote="swTarget='false'">
                        </embed>
                    </object>
                    <?php
                       break;
                       case 'html':
                        echo $html_content;
                        break;
                        case 'java':
                    ?>
                    <applet width="456" height="440" name="demo" archive="<?php echo $flash_url; ?>" code="vNES.class">
                        <param value="http://www.thegioigamevui.com/" name="codebase">
                        <param value="games/files/hi-game_1999_-_super_donkey_kong_2.zip" name="ROMFILE">
                        <param value="false" name="LIGHTGUN">
                        <param value="http://www.nesforever.com/nintendo/nescafeload.php" name="LOADDATAURL">
                        <param value="http://www.nesforever.com/nintendo/nescafesave.php" name="SAVEDATAURL">
                        You need to download and install <a target="_blank" href="http://www.java.com/en/download/manual.jsp">Java</a> to play.
                    </applet>
                    <?php
                        break;
                    }
                    ?>
                    </p>
                </td>
            </tr>
            <tr id="content_upload">
              <td width="200" class="key"><label for="filename">upload</label>
              </td>
              <td>
                    <?php echo $this->Form->input('filename', array('type'=>'file', 'class'=>'inputbox', 'size'=> 40, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr id="content_htmlcode" style="display: none;">
              <td width="200" class="key"><label for="html_content">Code</label>
              </td>
              <td>
                    <?php echo $this->Form->input('html_content', array('class'=>'inputbox', 'cols'=> 60, 'label'=> false, 'type'=>'textarea','div'=>false)); ?>
              </td>
            </tr>
            <?php if($check_thumbnail_exist): ?>
            <tr>
              <td width="200" class="key"><label for="preview">Preview </label>
              </td>
              <td>
                    <?php
                        echo $this->Html->image($image_url);
                    ?>
              </td>

            </tr>
            <?php endif; ?>
            <tr>
              <td width="200" class="key"><label for="thumbnail">Thumbnail </label>
              </td>
              <td>
                    <?php echo $this->Form->input('thumbnail', array('type'=>'file', 'class'=>'inputbox', 'size'=> 40, 'label'=> false,'div'=>false)); ?>
              </td>
            </tr>
            <tr>
              <td class="key"><label for="content">Nội dung & Hướng dẫn chơi game </label>
              </td>
              <td>
                    <?php echo $this->Editor->loadEditor('data[Game][description]', $description); ?>
              </td>
            </tr>
          </tbody>
        </table>
        </fieldset>
      </div>
      <div class="clr"></div>
      <?php echo $this->Form->input('id', array('type'=>'hidden')); ?>
      <input type="hidden" name="task" value="" />
    </form>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
